﻿@model IEnumerable<duanzhi.web.Models.article>
@using duanzhi.web.Models;
@using publicLibrary;

@{
    var tags = ViewBag.tags as IQueryable<tag>;
    pageNav pn = ViewBag.pageNav as pageNav;
    ViewBag.Title = "Index";
}
<style>

</style>
<script src="~/Scripts/jquery-1.7.1.min.js" ></script>
<link type="text/css" rel="stylesheet" href="~/Content/themes/base/jquery-ui.css" />

<script src="~/Scripts/jquery-ui-1.8.20.js"></script>
<script src="~/Content/ckeditor/ckeditor.js" ></script>

<script src="~/Content/wordPaster/WordPaster.forCKeditor.js"></script>
<link type="text/css" rel="stylesheet" href="~/Content/wordPaster/WordPaster.css" />

<button onclick="$('#articleForm').show()" class="big">共享段子</button>

<div id="articleForm" class="color0b">
    <div style="text-align:right" class="color1b"><button onclick="$('#articleForm').hide()" style="margin-right:0px" class="color2b">关闭</button></div>
    <fieldset style="overflow-y:scroll; height:455px ">
        <legend>段子提交</legend>
        <form action="/a/aa" method="post" id="articleFormF" >


        <table style="width:100%">
        
            <tr>
                <td style="text-align:right">标题：</td>
                <td>
                    <input type="text" value="" name="title"/>通常为空，如果title存在。则首先显示
                </td>
            </tr>
            <tr>
                <td style="text-align:right">内容：
                    <br />
                    (通常都写在这里)
                </td>
                <td style="width:600px;">
                    <textarea name="content" id="content" ></textarea>
                    
                </td>
            </tr>
            <tr>
                <td style="text-align:right">标签：</td>
                <td>
                    <input value="" type="text" name="tagsStr" id="tagStr"/>
                    <div onclick="pushTag(event)" class="tags">
                        @foreach (tag t in tags) { 
                            <label>@t.name</label>
                        }
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:right">作者：</td>
                <td>
                    <input value="" name="userID" type="hidden" />
                    <input value="" name="userName" id="userName" type="text" class="small" />
                    来至：<input value="" name="from" type="text" class="small" />
                </td>

            </tr></table>
            <div style="text-align:right"><button type="button" onclick="articleSubmit()" style="width:100px">提交</button></div>
    </form>
        <div style="padding-left:20px; color:gray; font-style:italic">若要使用黏贴版图片直接上传，请安装第三方插件

<ul>
<li>如果浏览器无法识别数字证书请下载运行<a href="http://yunpan.cn/lk/sVWS4E6bXChcZ" target="_blank">数字证书根证书</a></li>
<li>如果无法安装控件请下载运行<a href="http://yunpan.cn/lk/sV5IqqTYTmXXi" target="_blank">VC库</a></li>
<li><a target="_blank" href="http://yunpan.cn/lk/sVWBJVRxnHb6f">crx安装包</a>安装后可支持Chrome(谷歌浏览器)</li>
<li><a target="_blank" href="http://yunpan.cn/lk/sVWBAU5Ldnbvr">exe安装包</a>安装后可以支持IE(x86),IE(x64),Firefox,Chrome</li>
</ul>

        </div>
    </fieldset>


</div>

<div id="as">

@foreach (var item in Model) {
    <div class="article">
    @if(!String.IsNullOrWhiteSpace(item.title)){
        <div class="title">@item.title</div>
        <div class="content">@Html.Raw(item.content)</div>

    }else{
       <div class="title">@Html.Raw(@item.content)</div>
    }
        <div style="font-size:12px;" class="clear-fix">
            <div style="float:right">推荐人:@@@item.userName 赞：@item.recommend <button onclick="showReply(this,'@item.Id')">回复</button></div>
            @if(item.tags!=null){<div class="tags">@String.Join(",",item.tags)</div>}
            <div><span class="date">@item.datetime  </span>
             @if(!string.IsNullOrWhiteSpace(item.from)){
                 <span>来至:@item.from</span>
             }
            </div>
            
        </div>

        @if (item.reply != null)
        {
        <ul class="replys">
            @foreach (var reply in (item.reply).OrderByDescending(d => d.datetime))
            {
            <li>
                @@@reply.userName：@reply.content  &#160;&#160;&#160;&#160;<span class="date">[@item.datetime]</span>
            </li>
            }
        </ul>
        }
        
    </div>
}
</div>
<div style="text-align:right">
    <button type="button" onclick="window.location.href='/a/index?pageIndex=@(++pn.pageIndex)'" > 下一页 </button>
</div>

        <div style="display:none" id="replyForm" aID="">
            作者：<input value="" name="userName" class="small" id="replyUserName" /><input type="hidden" value="" name="replyUserID" />
            回复：<input name="replyContent" id="replyContent"/>
            <button onclick="submitReply(this)">提交</button>
        </div>
        
    <script type="text/javascript" src="~/Content/js/a.js"></script>